This patch was taken from the Arch Linux AUR:
https://aur.archlinux.org/cgit/aur.git/tree/pandoc_version.patch?h=rstudio-desktop
diff -ur a/CMakeGlobals.txt b/CMakeGlobals.txt
--- a/CMakeGlobals.txt	2022-07-06 12:59:49.000000000 -0700
+++ b/CMakeGlobals.txt	2022-07-17 20:10:59.016516702 -0700
@@ -231,7 +231,7 @@
 endif()
 
 # pandoc version
-set(PANDOC_VERSION "2.18" CACHE INTERNAL "Pandoc version")
+set(PANDOC_VERSION "current" CACHE INTERNAL "Pandoc version")
 
 # detect Centos 7, because we don't support Quarto on Centos7
 set(IS_CENTOS7 FALSE)
